<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>opennars: nars.io.ExperienceReader.nextInput</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">opennars
   &#160;<span id="projectnumber">1.5.5</span>
   </div>
   <div id="projectbrief">1.5-ish</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="../../index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="../../pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="../../namespaces.html"><span>Packages</span></a></li>
      <li><a href="../../annotated.html"><span>Classes</span></a></li>
      <li><a href="../../files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="../../search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="../../search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('d7/d69/classnars_1_1io_1_1ExperienceReader_a1a4b66a6e6cf89d5c2ea7a5923195247.html','../../');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="contents">
<a class="anchor" id="a1a4b66a6e6cf89d5c2ea7a5923195247"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">boolean nars.io.ExperienceReader.nextInput </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Process the next chunk of input data TODO duplicated code with <a class="el" href="../../">InputWindow#nextInput()</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>Whether the input channel should be checked again </dd></dl>

<p>Implements <a class="el" href="../../df/dd9/interfacenars_1_1io_1_1InputChannel_a9f4b85bfdac0509a3e3eaf839be88b43.html#a9f4b85bfdac0509a3e3eaf839be88b43">nars.io.InputChannel</a>.</p>

<p>Definition at line <a class="el" href="../../d3/d26/ExperienceReader_8java_source.html#l00101">101</a> of file <a class="el" href="../../d3/d26/ExperienceReader_8java_source.html">ExperienceReader.java</a>.</p>

<p>References <a class="el" href="../../d3/d26/ExperienceReader_8java_source.html#l00034">nars.io.ExperienceReader.reasoner</a>.</p>
<div class="fragment"><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;                               {</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944.html#a550c2b8a25ce59d79d1e27d5ea314944">timer</a> &gt; 0) {</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;            <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944.html#a550c2b8a25ce59d79d1e27d5ea314944">timer</a>--;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;        }</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;        <span class="keywordflow">if</span> (<a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_ab159e433cfda44807825df9a4e32c2a6.html#ab159e433cfda44807825df9a4e32c2a6">inExp</a> == null) {</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;        }</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;        String line = null;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;        <span class="keywordflow">while</span> (<a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944.html#a550c2b8a25ce59d79d1e27d5ea314944">timer</a> == 0) {</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;            <span class="keywordflow">try</span> {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;                line = <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_ab159e433cfda44807825df9a4e32c2a6.html#ab159e433cfda44807825df9a4e32c2a6">inExp</a>.readLine();</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;                <span class="keywordflow">if</span> (line == null) {</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;                    <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_ab159e433cfda44807825df9a4e32c2a6.html#ab159e433cfda44807825df9a4e32c2a6">inExp</a>.close();</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;                    <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_ab159e433cfda44807825df9a4e32c2a6.html#ab159e433cfda44807825df9a4e32c2a6">inExp</a> = null;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;                    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;                }</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;            } <span class="keywordflow">catch</span> (IOException ex) {</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;                System.out.println(<span class="stringliteral">&quot;i/o error: &quot;</span> + ex.getMessage());</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;            }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;            line = line.trim();</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;            <span class="comment">// read NARS language or an integer</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;            <span class="keywordflow">if</span> (line.length() &gt; 0) {</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;                <span class="keywordflow">try</span> {</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;                    <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944.html#a550c2b8a25ce59d79d1e27d5ea314944">timer</a> = Integer.parseInt(line);</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;                    <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a2360054ef94073abe1df64f06ae20c3a.html#a2360054ef94073abe1df64f06ae20c3a">reasoner</a>.walk(<a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944.html#a550c2b8a25ce59d79d1e27d5ea314944">timer</a>);</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;                } <span class="keywordflow">catch</span> (NumberFormatException e) {</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;                    <a class="code" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a2360054ef94073abe1df64f06ae20c3a.html#a2360054ef94073abe1df64f06ae20c3a">reasoner</a>.textInputLine(line);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;                }</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;            }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        }</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;    }</div>
<div class="ttc" id="classnars_1_1io_1_1ExperienceReader_ab159e433cfda44807825df9a4e32c2a6_html_ab159e433cfda44807825df9a4e32c2a6"><div class="ttname"><a href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_ab159e433cfda44807825df9a4e32c2a6.html#ab159e433cfda44807825df9a4e32c2a6">nars.io.ExperienceReader.inExp</a></div><div class="ttdeci">BufferedReader inExp</div><div class="ttdoc">Input experience from a file. </div><div class="ttdef"><b>Definition:</b> <a href="../../d3/d26/ExperienceReader_8java_source.html#l00036">ExperienceReader.java:36</a></div></div>
<div class="ttc" id="classnars_1_1io_1_1ExperienceReader_a2360054ef94073abe1df64f06ae20c3a_html_a2360054ef94073abe1df64f06ae20c3a"><div class="ttname"><a href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a2360054ef94073abe1df64f06ae20c3a.html#a2360054ef94073abe1df64f06ae20c3a">nars.io.ExperienceReader.reasoner</a></div><div class="ttdeci">Memory.ReasonerBatch reasoner</div><div class="ttdoc">Reference to the reasoner. </div><div class="ttdef"><b>Definition:</b> <a href="../../d3/d26/ExperienceReader_8java_source.html#l00034">ExperienceReader.java:34</a></div></div>
<div class="ttc" id="classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944_html_a550c2b8a25ce59d79d1e27d5ea314944"><div class="ttname"><a href="../../d7/d69/classnars_1_1io_1_1ExperienceReader_a550c2b8a25ce59d79d1e27d5ea314944.html#a550c2b8a25ce59d79d1e27d5ea314944">nars.io.ExperienceReader.timer</a></div><div class="ttdeci">int timer</div><div class="ttdoc">Remaining working cycles before reading the next line. </div><div class="ttdef"><b>Definition:</b> <a href="../../d3/d26/ExperienceReader_8java_source.html#l00039">ExperienceReader.java:39</a></div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="../../d7/d81/namespacenars.html">nars</a></li><li class="navelem"><a class="el" href="../../db/d64/namespacenars_1_1io.html">io</a></li><li class="navelem"><a class="el" href="../../d7/d69/classnars_1_1io_1_1ExperienceReader.html">ExperienceReader</a></li>
    <li class="footer">Generated on Sun Jan 10 2016 18:03:59 for opennars by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
  </ul>
</div>
</body>
</html>
